import 'package:ad_common/third_ad.dart';
import 'package:ad_common/third_ad_instance.dart';
import 'package:flutter/foundation.dart';
import 'package:google_ad_plugin/google_reward_video_ad.dart';
import 'package:google_mobile_ads/google_mobile_ads.dart';

import 'google_banner_ad.dart';
import 'google_insert_ad.dart';
import 'google_native_ad.dart';
import 'google_splash_ad.dart';

/// FileName google_ad_manager
/// @Author zhuqingfang
/// @Date 2022/9/30 4:32 下午
/// @Description google ad manager
bool isSdkInit = false;
String adInstanceInitString = "AdInstanceInit";
void init(){
  debugPrint("google sdk init start");
  isSdkInit = true;
  MobileAds.instance.initialize();
}
void googleAdInstanceInit(){
  thirdAdInstance.adSourceMap[SourceAdType.adMobRewardVideoAd] = _createGoogleRewardVideoAdInstance;
  thirdAdInstance.adSourceMap[SourceAdType.adMobInsertAd] = _createGoogleInsertAdInstance;
  thirdAdInstance.adSourceMap[SourceAdType.adMobBannerAd] = _createGoogleBannerAdInstance;
  thirdAdInstance.adSourceMap[SourceAdType.adMobNativeAd] = _createGoogleNativeAdInstance;
  thirdAdInstance.adSourceMap[SourceAdType.adMobSplashAd] = _createGoogleSplashAdInstance;
}

ThirdAd _createGoogleRewardVideoAdInstance(ThirdAdParams thirdAdParams){
  return GoogleRewardVideoAd(thirdAdParams: thirdAdParams);
}
ThirdAd _createGoogleInsertAdInstance(ThirdAdParams thirdAdParams){
  return GoogleInsertAd(thirdAdParams: thirdAdParams);
}
ThirdAd _createGoogleBannerAdInstance(ThirdAdParams thirdAdParams){
  return GoogleBannerAd(thirdAdParams: thirdAdParams);
}
ThirdAd _createGoogleNativeAdInstance(ThirdAdParams thirdAdParams){
  return GoogleNativeAd(thirdAdParams: thirdAdParams);
}
ThirdAd _createGoogleSplashAdInstance(ThirdAdParams thirdAdParams){
  return GoogleSplashAd(thirdAdParams: thirdAdParams);
}
